﻿using System;

namespace Rocuna.Core.Exceptions
{
    /// <summary>
    /// Exception to throw when engine was trying to invoked before the start method was called.
    /// </summary>
    public class NotStartedException : Exception
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="NotStartedException"/> class.
        /// </summary>
        /// <param name="engineType">Type of the engine.</param>
        public NotStartedException(Type engineType)
            : this(engineType, "Engine was not started before trying to use it")
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="NotStartedException"/> class.
        /// </summary>
        /// <param name="engineType">Type of the engine.</param>
        /// <param name="msg">The MSG.</param>
        public NotStartedException(Type engineType, string msg)
            : this(engineType, msg, null)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="NotStartedException"/> class.
        /// </summary>
        /// <param name="engineType">Type of the engine.</param>
        /// <param name="msg">The MSG.</param>
        /// <param name="innerException">The inner exception.</param>
        public NotStartedException(Type engineType, string msg, Exception innerException)
            : base(msg, innerException)
        {
            _engineType = engineType;
        }

        private readonly Type _engineType;

        /// <summary>
        /// Gets the type of the engine.
        /// </summary>
        /// <value>
        /// The type of the engine.
        /// </value>
        public Type EngineType { get { return _engineType; } }
    }
}